package com.sunrise.generico.entidade;

import java.util.Collection;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.Valid;

import lombok.Getter;
import lombok.Setter;

import org.hibernate.validator.constraints.NotEmpty;

import com.sunrise.generico.entidade.iface.EntidadeManter;

@Entity
@Table(name = "comunicacao_sms")
public class ComunicacaoSMS implements EntidadeManter {

	private static final long serialVersionUID = -3070159621011097321L;

	@Id
	@SequenceGenerator(name="pk_sequence",sequenceName="comunicacaoSMS_id_seq", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="pk_sequence")
	@javax.persistence.Column
	@Getter @Setter
	private Long id;
	
	@NotEmpty( message="{mensagemObrigatorio}")
	@Column(name = "nome", length = 250, nullable = false)
	@Getter @Setter
	private String nome;
	
	@Column(name = "dataEnvio")
	@Getter @Setter
	private Date dataEnvio;
	
	@Column(name = "dataCriacao")
	@Getter @Setter
	private Date dataCriacao;
	
	@OneToOne
	@Getter @Setter
	private Usuario criador;
	
	@Valid
	@ManyToOne
	@Getter @Setter
	private ContaSms contaSms;
	
	@Column(name = "prefixoValido")
	@Getter @Setter
	private String prefixoValido;
	
	@Column(name = "prefixoAdicionar")
	@Getter @Setter
	private String prefixoAdicionar;
	
	@Column(name = "adicionarDigito")
	@Getter @Setter
	private String adicionarDigito;
	
	@Column(name = "celularResponsavel")
	@Getter @Setter
	private String celularResponsavel;
	
	@OneToOne
	@Getter @Setter
	private Usuario remetente;
	
	@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
	@Getter @Setter
	private Collection<DestinatarioSMS> destinatarios;
	
	@OneToMany
	@Getter @Setter
	private Collection<RetornoSMS> retornos;
	
	@Column(name = "mensagemEnviada")
	@Getter @Setter
	private Boolean mensagemEnviada;
	
	@Column(name = "ativo")
	@Getter @Setter
	private Boolean ativo;
	
}
